package com.my.zxsyd.controller.admin;


import com.my.zxsyd.entity.Xygl;
import com.my.zxsyd.entity.Zuowei;
import com.my.zxsyd.entity.view.XyglView;
import com.my.zxsyd.qpage.QPage;
import com.my.zxsyd.service.IXyglService;
import com.my.zxsyd.util.ResultView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 信用管理表 前端控制器
 * </p>
 *
 * @author lbk
 * @since 2024-02-20
 */
@RestController
@RequestMapping("/api/admin/xygl")
public class XyglController {

    @Autowired
    private IXyglService service;

    /**
     * 列表分页
     * @param obj
     * @return
     */
    @GetMapping("/getPageList")
    public ResultView getPageList(QPage qPage, XyglView obj) {
        return this.service.getPageList(qPage,obj);
    }

    /**
     * 根据ID获取当前数据
     * @return
     */
    @GetMapping("/getById")
    public ResultView getById(@NotNull(message = "ID不能为空") Integer id) {
        Xygl obj=this.service.getById(id);
        return ResultView.ok(obj);
    }

    /**
     * 新增
     * @param obj
     * @return
     */
    @PostMapping("/add")
    public ResultView add(Xygl obj) {
        return this.service.add(obj);
    }

    /**
     * 删除
     * @return
     */
    @PostMapping("/del")
    public ResultView del(@NotNull(message = "ID不能为空") Integer id) {
        return this.service.del(id);
    }


    /**
     * 修改
     * @param obj
     * @return
     */
    @PostMapping("/up")
    public ResultView update(Xygl obj) {
        return this.service.up(obj);
    }



}
